import styles from "./style.module.css";
import FH from "@/assets/返回.svg?react";
import { useNavigate } from "react-router";

interface TitleProp {
  className?: string;
  children: any;
  extra?: any;
}
const Title: React.FC<TitleProp> = ({
  className = "",
  children,
  extra = null,
}) => {
  const navigate = useNavigate()
  return (
    <h2 className={`flex items-center px-[24px] ${styles.title} ${className}`}>
      <div onClick={() => navigate(-1)}>
        <FH width="20px" height="16px"></FH>
      </div>
      <div className="flex-1 text-center">{children}</div>
      <div>{extra}</div>
    </h2>
  );
};

export default Title;
